Helpful Information
 
 
Category: Firebird SQL Development
'Select a||b||c as test' issue

I write a sql statement to add 4 string to 1 , it gives strange result

Select a||b||c as test

if field c is null , then the result test is null . Otherwise it is normal .

Is this a bug , or I need to modify the statement .

any help is appreciated.

This is ansi sql standards. Try using
select ifnull(a, '') || ifnull(b, '') || ifnull(c, '') as test

Thanks for advise . Unfortunately it doesn't work ,error 'function unknown'

use coalesce unstead of nullif

Sorry I don't understand . Would you mind showing me the statement .
thx so much

select coalesce(a, '') || coalesce(b, '') || coalesce(c, '') as test

Thanks SwamBoogie.
I try this before your post ,but remain "function unknown"

Well as coalesce is standard I assumed it was supported.

You could try

select nz(a, '')

Maybe you have to write an IB function for this.










privacy (GDPR)